package com.tarena.dubbo.stock.web.rpc;

import com.tarena.dubbo.stock.api.StockApi;
import com.tarena.dubbo.stock.web.service.StockService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@DubboService//provider专属
@Component
@Slf4j
public class StockApiImpl implements StockApi {
    @Autowired
    private StockService stockService;

    @Override
    public boolean reduceStock(String productId, int count) {
        log.info("RPC接口接收请求 开始处理逻辑");
        return stockService.reduceStock(productId,count);
    }

    @Override
    public boolean returnStock(String productId, int count) {
        log.info("库存调用 归还逻辑 rpc入口");
        return stockService.returnStock(productId,count);
    }
}
